﻿using System;
using System.Web.UI;
using System.ComponentModel;
using System.Web;
using System.Security.Permissions;


[assembly: TagPrefix("MCCJ.ObjectDataSource", "mccj")]
namespace MCCJ
{
    /// <summary>表示为多层 Web 应用程序体系结构中的数据绑定控件提供数据的业务对象。</summary>
    //[PersistChildren(false), WebSysDisplayName("ObjectDataSource_DisplayName"), DefaultEvent("Selecting"), ParseChildren(true), Description("ObjectDataSource_Description"), ToolboxBitmap(typeof(ObjectDataSource)), DefaultProperty("TypeName"), Designer("System.Web.UI.Design.WebControls.ObjectDataSourceDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
    //[PersistChildren(false), DisplayName("Object"), DefaultEvent("Selecting"), ParseChildren(true), Description("Connect to a middle-tier business object or DataSet in the Bin or App_Code directory for the application."), ToolboxBitmap(typeof(ObjectDataSource)), DefaultProperty("TypeName"), Designer("System.Web.UI.Design.WebControls.ObjectDataSourceDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
    [PersistChildren(false), DisplayName("对象"), DefaultEvent("Selecting"), ParseChildren(true), Description("连接到应用程序的 Bin 或 App_Code 目录中的中间层业务对象或数据集。"), System.Drawing.ToolboxBitmap(typeof(ObjectDataSource)), DefaultProperty("TypeName"), Designer("System.Web.UI.Design.WebControls.ObjectDataSourceDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
    public class ObjectDataSource : System.Web.UI.WebControls.ObjectDataSource
    {
        public ObjectDataSource():base()
        {
            this.Selected += new System.Web.UI.WebControls.ObjectDataSourceStatusEventHandler(ObjectDataSource_Selected);
        }

        public ObjectDataSource(string typeName, string selectMethod): base(typeName, selectMethod)
        {
            
        }

        void ObjectDataSource_Selected(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
        {
            //e.OutputParameters
        }


        //protected override DataSourceView GetView(string viewName)
        //{
        //    if ((viewName == null) || ((viewName.Length != 0) && !string.Equals(viewName, "DefaultView", StringComparison.OrdinalIgnoreCase)))
        //    {
        //        throw new Exception();
        //        //throw new ArgumentException(SR.GetString("DataSource_InvalidViewName", new object[] { this.ID, "DefaultView" }), "viewName");
        //    }

        //    System.Reflection.FieldInfo _viewFieldInfo = typeof(System.Web.UI.WebControls.ObjectDataSource).GetField("_view", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.IgnoreCase);
        //    System.Web.UI.WebControls.ObjectDataSourceView _view = _viewFieldInfo.GetValue(this) as System.Web.UI.WebControls.ObjectDataSourceView;
        //    if (_view == null)
        //    {
        //        _view = new System.Web.UI.WebControls.ObjectDataSourceView(this, "DefaultView", this.Context);
        //        if (base.IsTrackingViewState)
        //        {
        //            ((IStateManager)_view).TrackViewState();
        //        }
        //    }
        //    _viewFieldInfo.SetValue(this, _view);
        //    return _view;
        //}

        
    }
}